home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / ADSP.p next >
Encoding:
Text File  |  1998-02-12  |  8.7 KB  |  235 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        ADSP.p
  3.  
  4.      Contains:    AppleTalk Data Stream Protocol (ADSP) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1986-1998, 1995-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT ADSP;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __ADSP__}
  28. {$SETC __ADSP__ := 1}
  29.  
  30. {$I+}
  31. {$SETC ADSPIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __ERRORS__}
  35. {$I Errors.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __APPLETALK__}
  38. {$I AppleTalk.p}
  39. {$ENDC}
  40.  
  41.  
  42. {$PUSH}
  43. {$ALIGN MAC68K}
  44. {$LibExport+}
  45.  
  46. {driver control csCodes}
  47.  
  48. CONST
  49.     dspInit                        = 255;                            {  create a new connection end  }
  50.     dspRemove                    = 254;                            {  remove a connection end  }
  51.     dspOpen                        = 253;                            {  open a connection  }
  52.     dspClose                    = 252;                            {  close a connection  }
  53.     dspCLInit                    = 251;                            {  create a connection listener  }
  54.     dspCLRemove                    = 250;                            {  remove a connection listener  }
  55.     dspCLListen                    = 249;                            {  post a listener request  }
  56.     dspCLDeny                    = 248;                            {  deny an open connection request  }
  57.     dspStatus                    = 247;                            {  get status of connection end  }
  58.     dspRead                        = 246;                            {  read data from the connection  }
  59.     dspWrite                    = 245;                            {  write data on the connection  }
  60.     dspAttention                = 244;                            {  send an attention message  }
  61.     dspOptions                    = 243;                            {  set connection end options  }
  62.     dspReset                    = 242;                            {  forward reset the connection  }
  63.     dspNewCID                    = 241;                            {  generate a cid for a connection end  }
  64.  
  65.                                                                 {  connection opening modes  }
  66.     ocRequest                    = 1;                            {  request a connection with remote  }
  67.     ocPassive                    = 2;                            {  wait for a connection request from remote  }
  68.     ocAccept                    = 3;                            {  accept request as delivered by listener  }
  69.     ocEstablish                    = 4;                            {  consider connection to be open  }
  70.  
  71.                                                                 {  connection end states  }
  72.     sListening                    = 1;                            {  for connection listeners  }
  73.     sPassive                    = 2;                            {  waiting for a connection request from remote  }
  74.     sOpening                    = 3;                            {  requesting a connection with remote  }
  75.     sOpen                        = 4;                            {  connection is open  }
  76.     sClosing                    = 5;                            {  connection is being torn down  }
  77.     sClosed                        = 6;                            {  connection end state is closed  }
  78.  
  79.                                                                 {  client event flags  }
  80.     eClosed                        = $80;                            {  received connection closed advice  }
  81.     eTearDown                    = $40;                            {  connection closed due to broken connection  }
  82.     eAttention                    = $20;                            {  received attention message  }
  83.     eFwdReset                    = $10;                            {  received forward reset advice  }
  84.  
  85.                                                                 {  miscellaneous constants  }
  86.     attnBufSize                    = 570;                            {  size of client attention buffer  }
  87.     minDSPQueueSize                = 100;                            {  Minimum size of receive or send Queue  }
  88.  
  89. { connection control block }
  90.  
  91. TYPE
  92.     TRCCBPtr = ^TRCCB;
  93.     TPCCB                                = ^TRCCB;
  94.     TRCCB = PACKED RECORD
  95.         ccbLink:                TPCCB;                                    {  link to next ccb  }
  96.         refNum:                    UInt16;                                    {  user reference number  }
  97.         state:                    UInt16;                                    {  state of the connection end  }
  98.         userFlags:                UInt8;                                    {  flags for unsolicited connection events  }
  99.         localSocket:            UInt8;                                    {  socket number of this connection end  }
  100.         remoteAddress:            AddrBlock;                                {  internet address of remote end  }
  101.         attnCode:                UInt16;                                    {  attention code received  }
  102.         attnSize:                UInt16;                                    {  size of received attention data  }
  103.         attnPtr:                Ptr;                                    {  ptr to received attention data  }
  104.         reserved:                PACKED ARRAY [0..219] OF UInt8;            {  for adsp internal use  }
  105.     END;
  106.  
  107. {$IFC TYPED_FUNCTION_POINTERS}
  108.     ADSPConnectionEventProcPtr = PROCEDURE(sourceCCB: TPCCB);
  109. {$ELSEC}
  110.     ADSPConnectionEventProcPtr = Register68kProcPtr;
  111. {$ENDC}
  112.  
  113. {$IFC TYPED_FUNCTION_POINTERS}
  114.     ADSPCompletionProcPtr = PROCEDURE(thePBPtr: DSPPBPtr);
  115. {$ELSEC}
  116.     ADSPCompletionProcPtr = Register68kProcPtr;
  117. {$ENDC}
  118.  
  119.     ADSPConnectionEventUPP = UniversalProcPtr;
  120.     ADSPCompletionUPP = UniversalProcPtr;
  121.     DSPParamBlockPtr = ^DSPParamBlock;
  122.     DSPParamBlock = PACKED RECORD
  123.         qLink:                    QElemPtr;
  124.         qType:                    INTEGER;
  125.         ioTrap:                    INTEGER;
  126.         ioCmdAddr:                Ptr;
  127.         ioCompletion:            ADSPCompletionUPP;
  128.         ioResult:                OSErr;
  129.         ioNamePtr:                StringPtr;
  130.         ioVRefNum:                INTEGER;
  131.         ioCRefNum:                INTEGER;                                {  adsp driver refNum  }
  132.         csCode:                    INTEGER;                                {  adsp driver control code  }
  133.         qStatus:                LONGINT;                                {  adsp internal use  }
  134.         ccbRefNum:                INTEGER;
  135.         CASE INTEGER OF
  136.         0: (
  137.             ccbPtr:                TPCCB;                                    {  pointer to connection control block  }
  138.             userRoutine:        ADSPConnectionEventUPP;                    {  client routine to call on event  }
  139.             sendQSize:            UInt16;                                    {  size of send queue (0..64K bytes)  }
  140.             sendQueue:            Ptr;                                    {  client passed send queue buffer  }
  141.             recvQSize:            UInt16;                                    {  size of receive queue (0..64K bytes)  }
  142.             recvQueue:            Ptr;                                    {  client passed receive queue buffer  }
  143.             attnPtr:            Ptr;                                    {  client passed receive attention buffer  }
  144.             localSocket:        UInt8;                                    {  local socket number  }
  145.             filler1:            UInt8;                                    {  filler for proper byte alignment  }
  146.            );
  147.         1: (
  148.             localCID:            UInt16;                                    {  local connection id  }
  149.             remoteCID:            UInt16;                                    {  remote connection id  }
  150.             remoteAddress:        AddrBlock;                                {  address of remote end  }
  151.             filterAddress:        AddrBlock;                                {  address filter  }
  152.             sendSeq:            UInt32;                                    {  local send sequence number  }
  153.             sendWindow:            UInt16;                                    {  send window size  }
  154.             recvSeq:            UInt32;                                    {  receive sequence number  }
  155.             attnSendSeq:        UInt32;                                    {  attention send sequence number  }
  156.             attnRecvSeq:        UInt32;                                    {  attention receive sequence number  }
  157.             ocMode:                UInt8;                                    {  open connection mode  }
  158.             ocInterval:            UInt8;                                    {  open connection request retry interval  }
  159.             ocMaximum:            UInt8;                                    {  open connection request retry maximum  }
  160.             filler2:            UInt8;                                    {  filler for proper byte alignment  }
  161.            );
  162.         2: (
  163.             abort:                UInt8;                                    {  abort connection immediately if non-zero  }
  164.             filler3:            UInt8;                                    {  filler for proper byte alignment  }
  165.            );
  166.         3: (
  167.             reqCount:            UInt16;                                    {  requested number of bytes  }
  168.             actCount:            UInt16;                                    {  actual number of bytes  }
  169.             dataPtr:            Ptr;                                    {  pointer to data buffer  }
  170.             eom:                UInt8;                                    {  indicates logical end of message  }
  171.             flush:                UInt8;                                    {  send data now  }
  172.            );
  173.         4: (
  174.             attnCode:            UInt16;                                    {  client attention code  }
  175.             attnSize:            UInt16;                                    {  size of attention data  }
  176.             attnData:            Ptr;                                    {  pointer to attention data  }
  177.             attnInterval:        UInt8;                                    {  retransmit timer in 10-tick intervals  }
  178.             filler4:            UInt8;                                    {  filler for proper byte alignment  }
  179.            );
  180.         5: (
  181.             statusCCB:            TPCCB;                                    {  pointer to ccb  }
  182.             sendQPending:        UInt16;                                    {  pending bytes in send queue  }
  183.             sendQFree:            UInt16;                                    {  available buffer space in send queue  }
  184.             recvQPending:        UInt16;                                    {  pending bytes in receive queue  }
  185.             recvQFree:            UInt16;                                    {  available buffer space in receive queue  }
  186.            );
  187.         6: (
  188.             sendBlocking:        UInt16;                                    {  quantum for data packets  }
  189.             sendTimer:            UInt8;                                    {  send timer in 10-tick intervals  }
  190.             rtmtTimer:            UInt8;                                    {  retransmit timer in 10-tick intervals  }
  191.             badSeqMax:            UInt8;                                    {  threshold for sending retransmit advice  }
  192.             useCheckSum:        UInt8;                                    {  use ddp packet checksum  }
  193.            );
  194.         7: (
  195.             newcid:                UInt16;                                    {  new connection id returned  }
  196.            );
  197.     END;
  198.  
  199.     DSPPBPtr                            = ^DSPParamBlock;
  200.  
  201. CONST
  202.     uppADSPConnectionEventProcInfo = $0000B802;
  203.     uppADSPCompletionProcInfo = $00009802;
  204.  
  205. FUNCTION NewADSPConnectionEventProc(userRoutine: ADSPConnectionEventProcPtr): ADSPConnectionEventUPP;
  206.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  207.     INLINE $2E9F;
  208.     {$ENDC}
  209.  
  210. FUNCTION NewADSPCompletionProc(userRoutine: ADSPCompletionProcPtr): ADSPCompletionUPP;
  211.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  212.     INLINE $2E9F;
  213.     {$ENDC}
  214.  
  215. PROCEDURE CallADSPConnectionEventProc(sourceCCB: TPCCB; userRoutine: ADSPConnectionEventUPP);
  216.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  217.     {To be implemented:  Glue to move parameters into registers.}
  218.     {$ENDC}
  219.  
  220. PROCEDURE CallADSPCompletionProc(thePBPtr: DSPPBPtr; userRoutine: ADSPCompletionUPP);
  221.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  222.     {To be implemented:  Glue to move parameters into registers.}
  223.     {$ENDC}
  224.  
  225. {$ALIGN RESET}
  226. {$POP}
  227.  
  228. {$SETC UsingIncludes := ADSPIncludes}
  229.  
  230. {$ENDC} {__ADSP__}
  231.  
  232. {$IFC NOT UsingIncludes}
  233.  END.
  234. {$ENDC}
  235.